package light.mvc.controller.meetingroom;



import light.mvc.controller.base.BaseController;
import light.mvc.pageModel.base.Json;
import light.mvc.pageModel.meetingroom.RegularPageModel;
import light.mvc.service.record.RoomScheduleServiceI;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping({ "/regularMeeting" })
public class RegularSettingController extends BaseController {
	@Autowired
	private RoomScheduleServiceI roomScheduleService;

	@RequestMapping({ "/setting" })
	public String setting() {
		return "/meetingroom/regular";
	}
	
	@RequestMapping({ "/addRoomScheduleEvent" })
	@ResponseBody
	public Json addRoomScheduleEvent(RegularPageModel regularPageModel ) {
		Json json = new Json();
		try {
			roomScheduleService.addRoomEvent(regularPageModel);
			json.setSuccess(true);
			json.setMsg("添加成功");
		} catch (Exception e) {
			e.printStackTrace();
			json.setSuccess(false);
			json.setMsg("添加失败");
		}
		return json;
	}
	
	@RequestMapping({ "/delete" })//删除的UI
	public String deleteUI(RegularPageModel regularPageModel ) {
		return "/meetingroom/regularDelete";
	}
	@RequestMapping({ "/deleteRoomScheduleEvent" })
	@ResponseBody
	public Json deleteRoomScheduleEvent(RegularPageModel regularPageModel ) {
		Json json = new Json();
		try {
			roomScheduleService.deleteRoomEvent(regularPageModel);
			json.setSuccess(true);
			json.setMsg("删除成功");
		} catch (Exception e) {
			e.printStackTrace();
			json.setSuccess(false);
			json.setMsg("删除失败");
		}
		return json;
	}

}
